package com.hdax.dm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdax.dm.entity.order.Order;
import com.hdax.dm.entity.order.OrderLinkUser;
import com.hdax.dm.entity.user.User;
import com.hdax.dm.mapper.order.OrderMapper;
import com.hdax.dm.service.OrderPService;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Service
public class OrderPServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderPService {

    @Override
    public boolean addOrder(Order order) {
        return baseMapper.addOrder(order);
    }

    @Override
    public boolean addOrderLink(OrderLinkUser orderLinkUser) {
        return baseMapper.addOrderLink(orderLinkUser);
    }

    @Override
    public Order FindByOrderId(String orderNo) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("orderNo",orderNo);
        Order order = baseMapper.selectOne(queryWrapper);
        return order;
    }

    @Override
    public Integer deleteOrderByNo(String orderNo) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("orderNo",orderNo);
        return baseMapper.delete(queryWrapper);
    }

    @Override
    public Integer updateOrderType(String orderNo, Integer type) {
        return baseMapper.updateOrderType(orderNo, type);
    }

    @Override
    public List<Order> queryorderlist(String keyword, Object orderTime, Object orderType, Long userId) {
        return baseMapper.queryorderlist(keyword, orderTime, orderType,userId);
    }

    @Override
    public boolean deleteticketbuyer(Long linkId) {
        return baseMapper.deleteticketbuyer(linkId);
    }

    @Override
    public User querypersoninfo(Long userId) {
        return baseMapper.querypersoninfo(userId);
    }

    @Override
    public boolean modifypersoninfo(User user) {
        return baseMapper.modifypersoninfo(user);
    }

    @Override
    public boolean modifypersoninfo1(Long id ,String imgUrl) {
        return baseMapper.modifypersoninfo1(id,imgUrl);
    }
}
